Root Zanli
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
o5t6x7pgljbm
/
www
/
admin
/
app
/
Models
/
Filename :
Store.php
back
Copy
<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\HasManyThrough; use Illuminate\Database\Eloquent\SoftDeletes; class Store extends Model { use SoftDeletes; protected $table = 'store'; protected $primaryKey = 'store_id'; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'group_id', 'store_name', 'created_by', 'created_at', 'updated_at', 'deleted_at' ]; /** * The attributes that should be hidden for arrays. * * @var array */ protected $hidden = [ 'deleted_at' ]; public function products() : HasManyThrough { $queryObject = $this->hasManyThrough( 'App\Models\Product','App\Models\StoreProduct', 'store_id', 'product_id', 'store_id', 'product_id') ->where('products.status', 'ACTIVE'); return $queryObject; } }